﻿using DotNetStar.TheKing.Infrastructure;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace DotNetStar.TheKing.Models
{
    public class LoginViewModel:IValidatableModel
    {
        [Display(Name ="帐号")]
        [Required(ErrorMessage = "{0}是必填项")]
        public string Account { get; set; }
        
        [Display(Name = "密码")]
        [Required(ErrorMessage = "{0}是必填项")]
        public string Password { get; set; }

        public string RedirectUrl { get; set; }
    }

    //public class RegisterViewModel:IValidatableModel
    //{
    //    [Display(Name = "帐号")]
    //    [Required(ErrorMessage ="{0}是必填项")]
    //    public string Account { get; set; }

    //    [Display(Name ="密码")]
    //    [Required(ErrorMessage ="{0}是必填项"),StringLength(25,ErrorMessage = "{0}长度限定于 {2}-{1} 个字符", MinimumLength =8)]
    //    public string Password { get; set; }
        

    //    [Display(Name ="昵称")]
    //    [Required(ErrorMessage = "{0}是必填项"), StringLength(20, ErrorMessage = "{0}必须在 {2}-{1} 个字符", MinimumLength = 2)]
    //    public string UserName { get; set; }

    //    [Display(Name ="验证码")]
    //    [Required(ErrorMessage ="{0}是必填项")]
    //    public string Code { get; set; }
    //}

    public class ResetPasswordViewModel:IValidatableModel
    {
        [Display(Name = "帐号")]
        [Required(ErrorMessage = "{0}是必填项")]
        public string Account { get; set; }


        [Display(Name = "新密码")]
        [Required(ErrorMessage = "{0}是必填项"), StringLength(25, ErrorMessage = "{0}必须在 {2}-{1} 个字符", MinimumLength = 8)]
        public string Password { get; set; }

        [Display(Name = "确认密码")]
        [Compare("Password",ErrorMessage ="两次密码不一致")]
        public string ConfirmPassword { get; set; }

        [Display(Name = "验证码")]
        [Required(ErrorMessage = "{0}是必填项")]
        public string Code { get; set; }


        [Display(Name = "昵称")]
        [Required(ErrorMessage = "{0}是必填项")]
        public string UserName { get; set; }
    }


    public class ChangeAvatarViewModel:IValidatableModel
    {
        [Required]
        public string AvatarUrl { get; set; }
        public long UserId { get; set; }
    }

    public class ChangePasswordViewModel:IValidatableModel
    {
        public long UserId { get; set; }
        [Display(Name ="旧密码")]
        [Required(ErrorMessage ="{0}是必填项")]
        public string OldPassword { get; set; }
        [Display(Name = "新密码")]
        [Required(ErrorMessage = "{0}是必填项"), StringLength(25, ErrorMessage = "{0}必须在 {2}-{1} 个字符", MinimumLength = 8)]
        public string NewPassword { get; set; }

        [Display(Name = "确认密码")]
        [Compare("NewPassword", ErrorMessage = "两次密码不一致")]
        public string ConfirmPassword { get; set; }
    }
}
